package com.wxapp.pay.service.util;

import com.wxapp.common.util.check.CheckUtil;
import com.wxapp.common.util.rsa.RSAUtil;

import java.util.Map;

/**
 * @author lgl
 */
public class AliPaySignUtil {
    private AliPaySignUtil() {
    }

    public static String getSign(String privateKey, Map<String, String> urlAppend) {
        urlAppend.remove("sign");
        var sign = UrlUtil.createLinkString(urlAppend, false);
        if (CheckUtil.isNullString(sign)) {
            return null;
        }
        return RSAUtil.signSha256(sign, privateKey);
    }
}
